package com.example.byteinputstream;

import java.io.FileInputStream;
import java.io.IOException;

public class ByteStreamDemo2 {
    public static void main(String[] args) throws IOException {

        /**
         * 字节输入流: FileInputStream
         * 文件向程序输入数据
         */

        //创建对象
        FileInputStream fis = new FileInputStream("src/com/example/file/a.txt");

        //读取数据
        //循环读取
        int read = fis.read();
        while (read != -1) {
            System.out.print((char) read);
            read = fis.read();
        }

        //释放资源
        fis.close();

    }
}
